package com.dsy.result;

import lombok.Data;

@Data
public class Result<T> {
    //响应码 0 失败 1 成功
    private String code;
    //响应信息
    private String message;
    //响应数据
    private T data;

    public Result(String code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public static <T> Result<T> success(T data) {
        return new Result<T>("1", "success", data);
    }

    public static <T> Result<T> error(String message) {
        return new Result<T>("0", message, null);
    }


}
